For and Foreach Loop for Printing Values of an Array

Develop a program to use for and foreach loop for printing values of an array and display the number of even and odd numbers.

Program

interface Sample

{

void show();

int a=10;

}

class ABC implements Sample

{

        public void show()

       {

               System.out.println("Show method called" + a);

       }

class Demo190

{

       public static void main(String args[])

      { 

               ABC ob=new ABC();

              ob.show();

              System.out.println("with class name "+ABC.a);

       }

}

Java Tips

See also

Do you have a Java Problem?
Ask It in The Java Forum

Java Books
Java Certification, Programming, JavaBean and Object Oriented Reference Books

Return to : Java Programming Hints and Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.